/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @signatureAlgorithm = 'v2';
  @endpointRule = 'regional';
  
  checkConfig(config);
  @endpoint = getEndpoint('ecd', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CalMcpToolRequest {
  args?: string(name='Args'),
  authorization?: string(name='Authorization'),
  externalUserId?: string(name='ExternalUserId'),
  name?: string(name='Name'),
  server?: string(name='Server'),
  sessionId?: string(name='SessionId'),
  tool?: string(name='Tool'),
}

model CalMcpToolResponseBody = {
  code?: string(name='Code'),
  data?: any(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CalMcpToolResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CalMcpToolResponseBody(name='body'),
}

/**
 * @summary 调用mcp工具
 *
 * @param request CalMcpToolRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CalMcpToolResponse
 */
async function calMcpToolWithOptions(request: CalMcpToolRequest, runtime: Util.RuntimeOptions): CalMcpToolResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.args)) {
    body['Args'] = request.args;
  }
  if (!Util.isUnset(request.authorization)) {
    body['Authorization'] = request.authorization;
  }
  if (!Util.isUnset(request.externalUserId)) {
    body['ExternalUserId'] = request.externalUserId;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.server)) {
    body['Server'] = request.server;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['SessionId'] = request.sessionId;
  }
  if (!Util.isUnset(request.tool)) {
    body['Tool'] = request.tool;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CalMcpTool',
    version = '2020-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'Anonymous',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 调用mcp工具
 *
 * @param request CalMcpToolRequest
 * @return CalMcpToolResponse
 */
async function calMcpTool(request: CalMcpToolRequest): CalMcpToolResponse {
  var runtime = new Util.RuntimeOptions{};
  return calMcpToolWithOptions(request, runtime);
}

model CreateMcpSessionRequest {
  authorization?: string(name='Authorization'),
  externalUserId?: string(name='ExternalUserId'),
  sessionId?: string(name='SessionId'),
}

model CreateMcpSessionResponseBody = {
  code?: string(name='Code'),
  data?: {
    appInstanceId?: string(name='AppInstanceId'),
    errMsg?: string(name='ErrMsg'),
    resourceId?: string(name='ResourceId'),
    resourceUrl?: string(name='ResourceUrl'),
    sessionId?: string(name='SessionId'),
    success?: boolean(name='Success'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateMcpSessionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateMcpSessionResponseBody(name='body'),
}

/**
 * @summary 创建 mcp session
 *
 * @param request CreateMcpSessionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateMcpSessionResponse
 */
async function createMcpSessionWithOptions(request: CreateMcpSessionRequest, runtime: Util.RuntimeOptions): CreateMcpSessionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.authorization)) {
    body['Authorization'] = request.authorization;
  }
  if (!Util.isUnset(request.externalUserId)) {
    body['ExternalUserId'] = request.externalUserId;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['SessionId'] = request.sessionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateMcpSession',
    version = '2020-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'Anonymous',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建 mcp session
 *
 * @param request CreateMcpSessionRequest
 * @return CreateMcpSessionResponse
 */
async function createMcpSession(request: CreateMcpSessionRequest): CreateMcpSessionResponse {
  var runtime = new Util.RuntimeOptions{};
  return createMcpSessionWithOptions(request, runtime);
}

model DescribeDesktopsRequest {
  desktopId?: [ string ](name='DesktopId'),
  desktopName?: string(name='DesktopName'),
  desktopStatus?: string(name='DesktopStatus'),
  directoryId?: string(name='DirectoryId'),
  groupId?: string(name='GroupId'),
  maxResults?: int32(name='MaxResults'),
  nextToken?: string(name='NextToken'),
  officeSiteId?: string(name='OfficeSiteId'),
  regionId?: string(name='RegionId', description='This parameter is required.'),
  userName?: string(name='UserName'),
}

model DescribeDesktopsResponseBody = {
  desktops?: [ 
    {
      connectionStatus?: string(name='ConnectionStatus'),
      cpu?: int32(name='Cpu'),
      creationTime?: string(name='CreationTime'),
      dataDiskCategory?: string(name='DataDiskCategory'),
      dataDiskSize?: string(name='DataDiskSize'),
      desktopId?: string(name='DesktopId'),
      desktopName?: string(name='DesktopName'),
      desktopStatus?: string(name='DesktopStatus'),
      desktopType?: string(name='DesktopType'),
      directoryId?: string(name='DirectoryId'),
      disks?: [ 
        {
          diskId?: string(name='DiskId'),
          diskSize?: int32(name='DiskSize'),
          diskType?: string(name='DiskType'),
        }
      ](name='Disks'),
      endUserIds?: [ string ](name='EndUserIds'),
      imageId?: string(name='ImageId'),
      lastStartTime?: string(name='LastStartTime'),
      memory?: long(name='Memory'),
      networkInterfaceId?: string(name='NetworkInterfaceId'),
      officeSiteId?: string(name='OfficeSiteId'),
      policyGroupId?: string(name='PolicyGroupId'),
      systemDiskCategory?: string(name='SystemDiskCategory'),
      systemDiskSize?: int32(name='SystemDiskSize'),
    }
  ](name='Desktops'),
  nextToken?: string(name='NextToken'),
  requestId?: string(name='RequestId'),
}

model DescribeDesktopsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDesktopsResponseBody(name='body'),
}

/**
 * @param request DescribeDesktopsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDesktopsResponse
 */
async function describeDesktopsWithOptions(request: DescribeDesktopsRequest, runtime: Util.RuntimeOptions): DescribeDesktopsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.desktopId)) {
    query['DesktopId'] = request.desktopId;
  }
  if (!Util.isUnset(request.desktopName)) {
    query['DesktopName'] = request.desktopName;
  }
  if (!Util.isUnset(request.desktopStatus)) {
    query['DesktopStatus'] = request.desktopStatus;
  }
  if (!Util.isUnset(request.directoryId)) {
    query['DirectoryId'] = request.directoryId;
  }
  if (!Util.isUnset(request.groupId)) {
    query['GroupId'] = request.groupId;
  }
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.officeSiteId)) {
    query['OfficeSiteId'] = request.officeSiteId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.userName)) {
    query['UserName'] = request.userName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDesktops',
    version = '2020-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeDesktopsRequest
 * @return DescribeDesktopsResponse
 */
async function describeDesktops(request: DescribeDesktopsRequest): DescribeDesktopsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDesktopsWithOptions(request, runtime);
}

model DescribeDirectoriesRequest {
  directoryId?: [ string ](name='DirectoryId'),
  directoryType?: string(name='DirectoryType', description='This parameter is required.'),
  maxResults?: int32(name='MaxResults'),
  nextToken?: string(name='NextToken'),
}

model DescribeDirectoriesResponseBody = {
  directories?: [ 
    {
      ADConnectors?: [ 
        {
          ADConnectorAddress?: string(name='ADConnectorAddress'),
          connectorStatus?: string(name='ConnectorStatus'),
          vSwitchId?: string(name='VSwitchId'),
        }
      ](name='ADConnectors'),
      creationTime?: string(name='CreationTime'),
      customSecurityGroupId?: string(name='CustomSecurityGroupId'),
      directoryId?: string(name='DirectoryId'),
      directoryType?: string(name='DirectoryType'),
      dnsAddress?: [ string ](name='DnsAddress'),
      dnsUserName?: string(name='DnsUserName'),
      domainName?: string(name='DomainName'),
      domainPassword?: string(name='DomainPassword'),
      domainUserName?: string(name='DomainUserName'),
      enableInternetAccess?: boolean(name='EnableInternetAccess'),
      name?: string(name='Name'),
      status?: string(name='Status'),
      trustPassword?: string(name='TrustPassword'),
    }
  ](name='Directories'),
  nextToken?: string(name='NextToken'),
  requestId?: string(name='RequestId'),
}

model DescribeDirectoriesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDirectoriesResponseBody(name='body'),
}

/**
 * @param request DescribeDirectoriesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDirectoriesResponse
 */
async function describeDirectoriesWithOptions(request: DescribeDirectoriesRequest, runtime: Util.RuntimeOptions): DescribeDirectoriesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.directoryId)) {
    query['DirectoryId'] = request.directoryId;
  }
  if (!Util.isUnset(request.directoryType)) {
    query['DirectoryType'] = request.directoryType;
  }
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDirectories',
    version = '2020-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeDirectoriesRequest
 * @return DescribeDirectoriesResponse
 */
async function describeDirectories(request: DescribeDirectoriesRequest): DescribeDirectoriesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDirectoriesWithOptions(request, runtime);
}

model GetConnectionTicketRequest {
  clientOS?: string(name='ClientOS'),
  clientVersion?: string(name='ClientVersion'),
  desktopId?: string(name='DesktopId'),
  instanceId?: string(name='InstanceId'),
  ownerId?: long(name='OwnerId'),
  password?: string(name='Password'),
  regionId?: string(name='RegionId', description='This parameter is required.'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  taskId?: string(name='TaskId'),
  userName?: string(name='UserName'),
}

model GetConnectionTicketResponseBody = {
  requestId?: string(name='RequestId'),
  taskId?: string(name='TaskId'),
  taskStatus?: string(name='TaskStatus'),
  ticket?: string(name='Ticket'),
}

model GetConnectionTicketResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetConnectionTicketResponseBody(name='body'),
}

/**
 * @param request GetConnectionTicketRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetConnectionTicketResponse
 */
async function getConnectionTicketWithOptions(request: GetConnectionTicketRequest, runtime: Util.RuntimeOptions): GetConnectionTicketResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientOS)) {
    query['ClientOS'] = request.clientOS;
  }
  if (!Util.isUnset(request.clientVersion)) {
    query['ClientVersion'] = request.clientVersion;
  }
  if (!Util.isUnset(request.desktopId)) {
    query['DesktopId'] = request.desktopId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.password)) {
    query['Password'] = request.password;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  if (!Util.isUnset(request.userName)) {
    query['UserName'] = request.userName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetConnectionTicket',
    version = '2020-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request GetConnectionTicketRequest
 * @return GetConnectionTicketResponse
 */
async function getConnectionTicket(request: GetConnectionTicketRequest): GetConnectionTicketResponse {
  var runtime = new Util.RuntimeOptions{};
  return getConnectionTicketWithOptions(request, runtime);
}

model GetMcpResourceRequest {
  authorization?: string(name='Authorization'),
  sessionId?: string(name='SessionId'),
}

model GetMcpResourceResponseBody = {
  code?: string(name='Code'),
  data?: {
    desktopInfo?: {
      appId?: string(name='AppId'),
      authCode?: string(name='AuthCode'),
      connectionProperties?: string(name='ConnectionProperties'),
      resourceId?: string(name='ResourceId'),
      resourceType?: string(name='ResourceType'),
    }(name='DesktopInfo'),
    resourceUrl?: string(name='ResourceUrl'),
    sessionId?: string(name='SessionId'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetMcpResourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetMcpResourceResponseBody(name='body'),
}

/**
 * @summary GetMcpResource
 *
 * @param request GetMcpResourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetMcpResourceResponse
 */
async function getMcpResourceWithOptions(request: GetMcpResourceRequest, runtime: Util.RuntimeOptions): GetMcpResourceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.authorization)) {
    body['Authorization'] = request.authorization;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['SessionId'] = request.sessionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetMcpResource',
    version = '2020-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'Anonymous',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary GetMcpResource
 *
 * @param request GetMcpResourceRequest
 * @return GetMcpResourceResponse
 */
async function getMcpResource(request: GetMcpResourceRequest): GetMcpResourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return getMcpResourceWithOptions(request, runtime);
}

model ListMcpToolsRequest {
  authorization?: string(name='Authorization'),
}

model ListMcpToolsResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListMcpToolsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListMcpToolsResponseBody(name='body'),
}

/**
 * @summary 获取工具列表
 *
 * @param request ListMcpToolsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListMcpToolsResponse
 */
async function listMcpToolsWithOptions(request: ListMcpToolsRequest, runtime: Util.RuntimeOptions): ListMcpToolsResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.authorization)) {
    body['Authorization'] = request.authorization;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListMcpTools',
    version = '2020-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'Anonymous',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取工具列表
 *
 * @param request ListMcpToolsRequest
 * @return ListMcpToolsResponse
 */
async function listMcpTools(request: ListMcpToolsRequest): ListMcpToolsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listMcpToolsWithOptions(request, runtime);
}

model RebootDesktopsRequest {
  clientOS?: string(name='ClientOS'),
  clientVersion?: string(name='ClientVersion'),
  desktopId?: [ string ](name='DesktopId', description='This parameter is required.'),
  regionId?: string(name='RegionId', description='This parameter is required.'),
}

model RebootDesktopsResponseBody = {
  requestId?: string(name='RequestId'),
}

model RebootDesktopsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RebootDesktopsResponseBody(name='body'),
}

/**
 * @param request RebootDesktopsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RebootDesktopsResponse
 */
async function rebootDesktopsWithOptions(request: RebootDesktopsRequest, runtime: Util.RuntimeOptions): RebootDesktopsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientOS)) {
    query['ClientOS'] = request.clientOS;
  }
  if (!Util.isUnset(request.clientVersion)) {
    query['ClientVersion'] = request.clientVersion;
  }
  if (!Util.isUnset(request.desktopId)) {
    query['DesktopId'] = request.desktopId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RebootDesktops',
    version = '2020-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request RebootDesktopsRequest
 * @return RebootDesktopsResponse
 */
async function rebootDesktops(request: RebootDesktopsRequest): RebootDesktopsResponse {
  var runtime = new Util.RuntimeOptions{};
  return rebootDesktopsWithOptions(request, runtime);
}

model ReleaseMcpSessionRequest {
  authorization?: string(name='Authorization'),
  sessionId?: string(name='SessionId'),
}

model ReleaseMcpSessionResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ReleaseMcpSessionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ReleaseMcpSessionResponseBody(name='body'),
}

/**
 * @summary 创建 mcp session
 *
 * @param request ReleaseMcpSessionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ReleaseMcpSessionResponse
 */
async function releaseMcpSessionWithOptions(request: ReleaseMcpSessionRequest, runtime: Util.RuntimeOptions): ReleaseMcpSessionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.authorization)) {
    body['Authorization'] = request.authorization;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['SessionId'] = request.sessionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ReleaseMcpSession',
    version = '2020-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'Anonymous',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建 mcp session
 *
 * @param request ReleaseMcpSessionRequest
 * @return ReleaseMcpSessionResponse
 */
async function releaseMcpSession(request: ReleaseMcpSessionRequest): ReleaseMcpSessionResponse {
  var runtime = new Util.RuntimeOptions{};
  return releaseMcpSessionWithOptions(request, runtime);
}

model StartDesktopsRequest {
  clientOS?: string(name='ClientOS'),
  clientVersion?: string(name='ClientVersion'),
  desktopId?: [ string ](name='DesktopId', description='This parameter is required.'),
  regionId?: string(name='RegionId', description='This parameter is required.'),
}

model StartDesktopsResponseBody = {
  requestId?: string(name='RequestId'),
}

model StartDesktopsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StartDesktopsResponseBody(name='body'),
}

/**
 * @param request StartDesktopsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return StartDesktopsResponse
 */
async function startDesktopsWithOptions(request: StartDesktopsRequest, runtime: Util.RuntimeOptions): StartDesktopsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientOS)) {
    query['ClientOS'] = request.clientOS;
  }
  if (!Util.isUnset(request.clientVersion)) {
    query['ClientVersion'] = request.clientVersion;
  }
  if (!Util.isUnset(request.desktopId)) {
    query['DesktopId'] = request.desktopId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StartDesktops',
    version = '2020-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request StartDesktopsRequest
 * @return StartDesktopsResponse
 */
async function startDesktops(request: StartDesktopsRequest): StartDesktopsResponse {
  var runtime = new Util.RuntimeOptions{};
  return startDesktopsWithOptions(request, runtime);
}

model StopDesktopsRequest {
  clientOS?: string(name='ClientOS'),
  clientVersion?: string(name='ClientVersion'),
  desktopId?: [ string ](name='DesktopId', description='This parameter is required.'),
  regionId?: string(name='RegionId', description='This parameter is required.'),
}

model StopDesktopsResponseBody = {
  requestId?: string(name='RequestId'),
}

model StopDesktopsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StopDesktopsResponseBody(name='body'),
}

/**
 * @param request StopDesktopsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return StopDesktopsResponse
 */
async function stopDesktopsWithOptions(request: StopDesktopsRequest, runtime: Util.RuntimeOptions): StopDesktopsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientOS)) {
    query['ClientOS'] = request.clientOS;
  }
  if (!Util.isUnset(request.clientVersion)) {
    query['ClientVersion'] = request.clientVersion;
  }
  if (!Util.isUnset(request.desktopId)) {
    query['DesktopId'] = request.desktopId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StopDesktops',
    version = '2020-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request StopDesktopsRequest
 * @return StopDesktopsResponse
 */
async function stopDesktops(request: StopDesktopsRequest): StopDesktopsResponse {
  var runtime = new Util.RuntimeOptions{};
  return stopDesktopsWithOptions(request, runtime);
}

